class MyThread5 extends Thread{
    @Override
    public void run() {
        while (true){
            System.out.println("run方法!");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
public class ThreadDemo7 {
    public static void main(String[] args) {
        Thread thread = new MyThread5();

        thread.start();

        while (true){
            System.out.println("第二个线程!");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
